﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace RBAC.Repository
{
    public interface IRepository<T> where T : class,new() //约束
    {
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> AddAsync(T entity);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        Task<int> UpdateAsync(T entity);
        /// <summary>
        /// 批量修改
        /// </summary>
        /// <param name="entities"></param>
        /// <returns></returns>
        Task<int> UpdateRange(List<T> entities);
        /// <summary>
        /// 删除（真删）
        /// </summary>
        /// <param name="entities"></param>
        /// <returns></returns>
        Task<int> Delete(T rnintes);
        /// <summary>
        /// 反填或者是查询
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<T>  GetModelsAsync(int id);
       
        /// <summary>
        /// 显示全部
        /// </summary>
        /// <returns></returns>
        Task<List<T>> GetAllAsync();
        Task<List<T>> GetAsync(Expression<Func<T, bool>> expre);
       
    }
}
